<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="Generator" content="ALORK 20150428.01" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="Keywords" content="<?php echo $this->_var['keywords']; ?>" />
<meta name="Description" content="<?php echo $this->_var['description']; ?>" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0"/>

<title><?php echo $this->_var['page_title']; ?></title>

<link rel="shortcut icon" href="favicon.ico" />
<link rel="icon" href="animated_favicon.gif" type="image/gif" />
<link rel="stylesheet" href="./public/my_style.css" />
<script type="text/javascript" src="./../js/mobile-common.js"></script>
<?php echo $this->smarty_insert_scripts(array('files'=>'./../js/jquery.js,./../js/jquery.json-1.3.js,./../js/order-mobile.js')); ?>
</head>
<body >
<?php echo $this->fetch('library/user_head.lbi'); ?>
<script type="text/javascript">

    /*字体大小 自适应 rem单位*/
    function auto(){
        var width = $('body').width();
        if (width>480) {
          width = 480;
        };
        var font_size = 20*(width/320);
        var font_size2 = (width/320)*625+'%';
        $('body').css('font-size',font_size);
        $('html').css('font-size',font_size2);
    }
        auto();
    /*浏览器横屏坚屏改变时也运行函数*/
    window.onorientationchange = function() {
        auto();
    };
    /* 浏览器窗口发生改变也运行函数*/
    window.resize=function(){
        auto();
    };
</script>
<?php if ($this->_var['step'] == 'checkout' || $this->_var['step'] == 'imme_checkout'): ?>

<div id="confirm_order">
  <form action="flow.php" method="post"  id="PostOrder" >
    
    <?php if ($this->_var['consignee']['address_id']): ?>
    <table cellpadding="0" cellspacing="0" class="address" >
      <tr >
        <td style="width:100px; float:left;">
          <input style="width:100px; float:left;" type="text" name="consignee" id="consignee"  size="9" value="<?php echo htmlspecialchars($this->_var['consignee']['consignee']); ?>" readonly="readonly"/>
        </td>
        <td style="float:left; width:150px; margin-left: 10px;">
          <input style="float:left;" type="number" name="mobile" id="mobile" value="<?php echo htmlspecialchars($this->_var['consignee']['mobile']); ?>" maxlength="11" readonly="readonly"/>
        </td>
      </tr>
      <tr >
        <td ><?php echo htmlspecialchars($this->_var['consignee']['area_address']); ?></td>
      </tr>
      <tr >
        <td tyle="width:275px; float:left;">
          <input style="width:275px; float:left; text-overflow: ellipsis; white-space: nowrap;" type="text"  id="address" name="address" size="40" value="<?php echo $this->_var['consignee']['address']; ?>" readonly="readonly"/>
          <input type="hidden" id='AddressId' value="<?php echo $this->_var['consignee']['address_id']; ?>" />
        </td>
      </tr>
    </table>
    <a href="address.php?act=address_select&rid=<?php echo $this->_var['rid']; ?>"><div class="arrow"></div></a>
    <?php else: ?>
    <a href="address.php?act=address_select&rid=<?php echo $this->_var['rid']; ?>"><div class="no_address_id">选择收货地址</div></a>
    <?php endif; ?>

    
    <table cellpadding="0" cellspacing="0" class="pay" >
      <tr class="pay_tr">
        <td width="65" style="color:#585858;">支付
          <input type="hidden" name="payment" id="payment" value="<?php echo $this->_var['payment']['pay_id']; ?>"/>
        </td>
        <td style="color:#343434">
          <?php echo $this->_var['payment']['pay_name']; ?>
        </td>
        <td>
          <a href="flow.php?step=select_payment&rid=<?php echo $this->_var['rid']; ?>"><div class="arrow"></div></a>
        </td>
      </tr>
    </table>

    
    <table cellpadding="0" cellspacing="0" class="goods" >
      <tr class="goods_tr">
        <td width="65" style="color:#585858;">产品
          <input type="hidden" name="payment" id="payment" value="<?php echo $this->_var['payment']['pay_id']; ?>"/>
        </td>
        <td class="sum_goods_number" style="color:#343434">
          <span><?php echo $this->_var['total']['goods_number_sum']; ?></span>件产品
        </td>
        <td>
          <div class="arrow" id="arrow" onclick="changeGoodsList();"></div>
        </td>
      </tr>
    </table>

    
    <table width="100%" cellpadding="5" cellspacing="0" class="order " style="display: none;">
      <?php $_from = $this->_var['goods_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'goods');if (count($_from)):
    foreach ($_from AS $this->_var['goods']):
?>
      <?php if ($this->_var['goods']['is_buy'] == 0): ?>
      <tr >
        <td width="80" class="no_goods"> <a href="goods.php?id=<?php echo $this->_var['goods']['goods_id']; ?>">
          <img src="./../<?php echo $this->_var['goods']['goods_thumb']; ?>" alt="" width="80" height="80"/></a></td>
        <td  class="no_goods">
          <span class="c_571d68" ><?php echo $this->_var['goods']['goods_name']; ?></span>
          <?php if ($this->_var['goods']['goods_attr']): ?> (<?php echo $this->_var['goods']['goods_attr']; ?>) <?php endif; ?><br /></span> 
          <span > &nbsp;&nbsp;&nbsp;&nbsp;已抢完</span>
          <br />
          <span class="goods_price" ><?php echo $this->_var['goods']['formated_goods_price']; ?></span><br />
        </td>
      </tr>
      <?php else: ?>
      <tr >
        <td width="80" class="img"> <a href="goods.php?id=<?php echo $this->_var['goods']['goods_id']; ?>">
          <img src="./../<?php echo $this->_var['goods']['goods_thumb']; ?>" alt="" width="80" height="80"/></a>
        </td>
        <td class="goods_some">
          <span class="c_571d68" ><?php echo $this->_var['goods']['goods_name']; ?></span>
          <?php if ($this->_var['goods']['goods_attr']): ?> (<?php echo $this->_var['goods']['goods_attr']; ?>) <?php endif; ?><br /></span> 
          <span class="goods_price" >
            <e style="font-size: 12px;color:#8E1519;">￥</e>
          <span class='goods_buy_price'><?php echo $this->_var['goods']['goods_price']; ?></span>
          </span>
          <div style="display: none;" class='subtotals'>
            <span preferential="<?php echo $this->_var['goods']['preferential']; ?>"><?php echo $this->_var['goods']['subtotal']; ?></span>
          </div>
          <span class="goods_num">
            <div class="cart_num">
              <span><?php echo $this->_var['goods']['goods_number']; ?></span>
            </div>
          </span>
        </td>
      </tr>
      <?php endif; ?>
      <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
    </table>
    
    <div class="order_message">
    <input name="postscript" cols="80" rows="3" id="postscript" placeholder="订单备注：限50字以内">
    </input>
    <span class="img"></span>
    </div>
    <?php echo $this->fetch('library/order_total.lbi'); ?>
  </form>
</div>
<?php endif; ?>


 <?php if ($this->_var['step'] == 'select_payment'): ?>

<div id="select_payment">
  <table width="100%" cellpadding="0" cellspacing="0" class="select_payment">
    <tr>
      <td>支付信息</td>
    </tr>
    <?php $_from = $this->_var['payment_list']; if (!is_array($_from) && !is_object($_from)) { settype($_from, 'array'); }; $this->push_vars('', 'payment_0_26417000_1443348270');if (count($_from)):
    foreach ($_from AS $this->_var['payment_0_26417000_1443348270']):
?>
    <tr>
      <td class="pay_msg">
        <span class="pay_icon <?php if ($this->_var['payment_0_26417000_1443348270']['pay_id'] == $this->_var['pay_id']): ?> now <?php else: ?> no <?php endif; ?>  "></span>
        <input type="hidden" name='pay' value="<?php echo $this->_var['payment_0_26417000_1443348270']['pay_id']; ?>" />  <?php echo $this->_var['payment_0_26417000_1443348270']['pay_name']; ?>
      </td>
    </tr>
    <?php endforeach; endif; unset($_from); ?><?php $this->pop_vars();; ?>
  </table>
  <div class="confirm" onclick="select_payment('<?php echo $this->_var['rid']; ?>')">确认</div>
</div>

<script type="text/javascript">
  $('.pay_msg').click(function(){
    $('.pay_msg').find('.pay_icon').removeClass('no').removeClass('now').addClass('no');
    $(this).find('.pay_icon').removeClass('no').addClass('now');
  });
//选择支付方式
function select_payment(rid){
        var url = "flow.php?step=select_payment&r="+Math.random();
        var pay_id = $('.now').siblings('input').val();
        htmlobj=$.post(url, {'pay_id' : pay_id, 'rid' : rid}, function(data){
          select_payment_return(data);
        },'JSON');
}
function select_payment_return(data){
      window.location.href= data;
}
</script>

<?php endif; ?>

</body>



<script type="text/javascript">
  // /* 点击商品添加、减少和输入方法 */
  // function cart_button(obj,num){
  //   var goods_num   = parseInt($('.num_input').val());
  //   var goods_price = parseFloat($('.goods_buy_price').text());
  //   var total_price = $('.goods_price_formated').find('.right').text();
  //   if( num == '1' ){
  //     alert(goods_price);
  //   }
  // }

  // /* 点击商品添加、减少和输入方法 */
  // function cart_button(obj, num){
  //   if(num == '1'){
  //     var val= parseInt($(obj).siblings('.num_input').val());
  //     var id = parseInt($(obj).siblings('.num_input').attr('id'));
  //     if(val>1){
  //       val -= 1;
  //     }else{
  //       location.href = history.back(-1)
  //     }
  //     $(obj).siblings('.num_input').val(val);
  //     var prices = $(obj).parent().parent().siblings('.goods_price').find('span').text();
  //     var shipping_fee = $('#shipping_fee span').text();
  //     $(obj).parent().siblings('.subtotals').find('span').text((prices*val).toFixed(2));
  //     ajax_update_cart(id,val,$(obj).parent().parent().siblings('.goods_price').find('span'));
  //   }
  //   else if(num == '2'){
  //     var val=parseInt($(obj).val());
  //     var id = parseInt($(obj).attr('id'));
  //     var goods_stock = $(obj).siblings('.goods_stock').val();
  //     if(val>0 && goods_stock >= val){
  //       $(obj).val(val);
  //     }else{
  //       point('商品只剩'+goods_stock+'件',1);
  //       val = goods_stock;
  //       $(obj).val(val);
  //     }
  //     var prices = $(obj).parent().parent().siblings('.goods_price').find('span').text();
  //     var shipping_fee = $('#shipping_fee span').text();
  //     $(obj).parent().siblings('.subtotals').find('span').text((prices*val).toFixed(2));
  //     ajax_update_cart(id,val,$(obj).parent().parent().siblings('.goods_price').find('span'));
  //   }else if(num == '3'){
  //     var val=parseInt($(obj).siblings('.num_input').val());
  //     var id = parseInt($(obj).siblings('.num_input').attr('id'));
  //     var goods_stock = $(obj).siblings('.goods_stock').val();
  //     if(val>0){
  //       val += 1;
  //       if(goods_stock < val){
  //         point('商品只剩'+goods_stock+'件',1);
  //         val = goods_stock;
  //       }
  //     }
  //     $(obj).siblings('.num_input').val(val);
  //     var prices = $(obj).parent().parent().siblings('.goods_price').find('span').text();
  //     var shipping_fee = $('#shipping_fee span').text();
  //     $(obj).parent().siblings('.subtotals').find('span').text((prices*val).toFixed(2));
  //     ajax_update_cart(id,val,$(obj).parent().parent().siblings('.goods_price').find('span'));
  //   }
  // }

  // function ajax_update_cart(id, number, obj){
  //   if(id>0 && number>0){
  //     var htmlobj=$.ajax({url:"flow.php?step=ajax_update_cart",type: "POST",data: {id:id,goods_number:number},async:false,dataType:'json',success:function(msg){
  //       $(obj).text(msg.goods_price);
  //       $(obj).text(msg.shipping_fee);
  //       $(obj).parent().siblings('.subtotals').find('span').text((msg.sub).toFixed(2));

  //       /* 商品总价 */
  //       var subtotals=0;
  //       $('.subtotals span').each(function(){
  //         subtotals += Number($(this).text());
  //       });
  //       $('#ECS_ORDERTOTAL .goods_price_formated .right span').text((subtotals).toFixed(2));

  //       /* 商品数量 */
  //       var sum_goods_number=0;
  //       $('.goods_num .cart_num .num_input').each(function(){
  //         sum_goods_number += Number($(this).val());
  //       });
  //       $('.goods_tr .sum_goods_number span').text(sum_goods_number);
  //     }});
  //   }
  // }

  /* 展开或隐藏商品列表 */
  function changeGoodsList(){
    var arrows = document.getElementById("arrow").className;
    if(arrows == 'arrow'){
      $('#PostOrder .order').css('display','block');
      document.getElementById("arrow").className = "arrow2";
    }else if(arrows == 'arrow2'){
      $('#PostOrder .order').css('display','none');
      document.getElementById("arrow").className = "arrow";
    }
  }
</script>
</html>